function deepCopy(obj){
    // 非空对象
    if(isObject(obj)){
        // const ob = Object.create(null)
        const ob = Object.create({})
        for (const key in obj) {
           if(isObject(obj[key])){
                ob[key] = deepCopy(obj[key])
           }else{
            ob[key]= obj[key]
           }
        }
        return ob
    }
    return obj
}

function isObject(obj){
    if(obj instanceof Array ||obj instanceof Function)
        return false
//    return obj !==null && obj instanceof Object
    return obj !==null && typeof obj === 'object'
}

const obj1 = {
    a:1,
    b:{
        c:2,
        d:{
            e:3
        }
    },
    f:5
}

const obj2 = deepCopy(obj1)
console.log(obj2)